package com.sinoair.worker.controller;

import com.sinoair.worker.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * demo-vue
 * ${desc}
 * <pre>
 *  Version         Date            Author          Description
 * ---------------------------------------------------------------------------------------
 *  1.0.0           2017/08/05     senlin        -
 * </pre>
 *
 * @author senlin
 * @version 1.0.0 2017/8/5 0005 8:48
 * @date 2017/8/5 0005 8:48
 * @since 1.0.0
 */

@RestController
@RequestMapping("/user")
public class UserController {


    @Autowired
    private UserService userService;

    @GetMapping("getTableData")
    public Map<String, Object> getTableData(int pageNum, int pageSize, String username) {
        try {
            return userService.getTableData(pageNum, pageSize, username);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @GetMapping(value = "/getUsername")
    public String getUsername(String callback) {
        return "admin";
    }

    @RequestMapping("/hello/{name}")
    public String hellName(@PathVariable String Name) {
        return "Hello " + Name;
    }


}
